package com.neusoft.tijiancms.controller;

import com.neusoft.tijiancms.dto.OrdersPageRequestDTO;
import com.neusoft.tijiancms.dto.OrdersPageResponseDTO;
import com.neusoft.tijiancms.po.Orders;
import com.neusoft.tijiancms.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/OrdersController")
public class OrdersController {
    @Autowired
    private OrdersService ordersService;

    /**
     * 请求地址：http://localhost:8088/tijiancms/OrdersController/listOrders
     * 分页查询体检预约列表
     * @param ordersPageRequestDTO
     * @return
     */
    @RequestMapping("/listOrders")
    public OrdersPageResponseDTO listOrders(@RequestBody OrdersPageRequestDTO ordersPageRequestDTO){
        return ordersService.listOrders(ordersPageRequestDTO);
    }
    /**
     *根据条件查询订单总行数
     * @param ordersPageRequestDTO
     * @return
     */
    @RequestMapping("/getOrdersCount")
    public int getOrdersCount(@RequestBody OrdersPageRequestDTO ordersPageRequestDTO){
        return ordersService.getOrdersCount(ordersPageRequestDTO);
    }
    /**
     * 根据orderId查询单个用户信息
     * @param orders
     * @return
     */
    @RequestMapping("/getOrderById")
    public Orders getOrderById(@RequestBody Orders orders){
        return ordersService.getOrderById(orders);
    }

    @RequestMapping("/updateOrdersState")
    public int updateOrdersState(@RequestBody Orders orders){
        return ordersService.updateOrdersState(orders);
    }
}
